import { http } from "@/api";
import { Login, Menu } from "../interface";
import authMenuList from "@/assets/json/authMenuList.json";
import { ownHttp } from "../ownIndex";

/**
 * @use 用户登录
 */
export const loginApi = (params: Login.ReqLoginForm) => {
  return http.post<any>(`/api/oauth/applogin`, null, { params });
};

/**
 * @use 获取历史记录列表详情
 */
export const gettaskinfoApi = (params: any) => {
  return http.get(`/api/v1/rbac/task/gettaskinfo`, { params });
};

/**
 * @use 获取批量消息的任务列表
 */
export const getbatchmsggApi = (params?: any) => {
  return http.post(`/api/v1/message/getbatchmsg`, null, { params });
};

/**
 * @use 获取公司列表
 */
export const getcustomerApi = (params?: any) => {
  return http.post(`/api/v1/rbac/platform/getcustomer`, null, { params });
};

/**
 * @use 获取可以分配的机器人列表
 */
export const setbotsApi = (params?: any) => {
  return http.post(`/api/v1/rbac/platform/setbots`, null, { params });
};

/**
 * @use 为客户分配机器人
 */
export const setcustomerbotApi = (params?: any) => {
  return http.post(`/api/v1/rbac/platform/setcustomerbot`, params);
};


/**
 * @use 上传图片
 */
export const uploadImgApi = (file: any) => {
  return http.post<any>(`/api/v1/rbac/file/uploadfilesajax`, file, {
    headers: {
      "Content-Type": "multipart/form-data;charset=UTF-8"
    }
  });
};




/**
 * @use 创建平台客户资料（客户入住）
 */
export const setcustomerApi = (params?: any) => {
  return http.post(`/api/v1/rbac/platform/setcustomer`, params);
};

export const getuserApi = (params?: any) => {
  return http.post(`/api/v1/rbac/user/getuser`, null, { params, loading: false });
};


/**
 * @use 获取用户协议列表F
 */
export const getcontractlistApi = (params?: any) => {
  return http.get(`/api/v1/rbac/user/getcontractlist`);
};


export const setuserApi = (params?: any) => {
  return http.post(`/api/v1/rbac/user/setuser`, params);
};
/**
 * @use 获取菜单列表
 */
export const getAuthMenuListApi = () => {
  // return ownHttp.get<Menu.MenuOptions[]>(`/user/sq/config/menu.info`);
  // 如果想让菜单变为本地数据，注释上一行代码，并引入本地 authMenuList.json 数据
  return authMenuList;
};
